package com.share.design.prototype;

import java.util.Scanner;

/**
 * author:caifan
 * date:2020/2/4
 */
public class Square implements Shape {
    @Override
    public Object clone() {
        Square square = null;
        try {
            square = (Square) super.clone();

        } catch (CloneNotSupportedException e) {
            System.out.println(" square copy failed");
        }
        return square;
    }

    @Override
    public void countArea() {
        int r=0;
        System.out.print("这是一个正方形，请输入边长：");
        Scanner input=new Scanner(System.in);
        r=input.nextInt();
        System.out.println("该正方形的面积=" + r * r + "\n");
    }
}
